package five_Net;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("192.168.43.125", 10099);
        OutputStream os = s.getOutputStream();
        os.write("hello, i am TCP/IP".getBytes());

//        BufferedInputStream bis = new BufferedInputStream(s.getInputStream());
//        byte[] bys = new byte[1024];
//        int len = bis.read(bys);
//        System.out.println("Client: " + new String(bys, 0, len));

        InputStream is = s.getInputStream();
        byte[] bys = new byte[1024];
        int len = is.read(bys);
        System.out.println("Client: " + new String(bys, 0, len));
        
        s.close();
    }
}
